Open
Conversation
…reserved attributes
naglepuff
requested changes
Feb 2, 2026
client/src/use/useAttributes.ts
Outdated
Comment on lines
70
to
72
| const reservedList = data.belongs === 'detection' | ||
| ? ['rotation', 'userModified'] | ||
| : ['userCreated']; |
Collaborator
There was a problem hiding this comment.
If we had an object, then we could just do reservedList = RESERVED_ATTRIBUTES[data.belongs];. If you don't like the object idea, then I think it would still be better to import the lists here instead of hard-coding them again.
Comment on lines
615
to
641
| if (this.arrowFeatureLayer) { | ||
| if (this.type === 'rectangle') { | ||
| const ann = this.featureLayer.annotations()[0]; | ||
| if (ann) { | ||
| const g = ann.geojson(); | ||
| if (g && g.geometry && g.geometry.type === 'Polygon') { | ||
| const coords = (g.geometry as GeoJSON.Polygon).coordinates[0]; | ||
| const rotation = getRotationFromAttributes(g.properties as Record<string, unknown>); | ||
| const unrotated = rotateGeoJSONCoordinates(coords, 0 - (rotation ?? 0)); | ||
| // create RectBounds from unrotated coordinates | ||
| const bounds: RectBounds = [Math.min(unrotated[0][0], unrotated[2][0]), Math.min(unrotated[0][1], unrotated[2][1]), Math.max(unrotated[0][0], unrotated[2][0]), Math.max(unrotated[0][1], unrotated[2][1])]; | ||
| const arrow = getRotationArrowLine(bounds, rotation ?? 0); | ||
| if (arrow) { | ||
| this.arrowFeatureLayer.data([{ c: arrow.coordinates }]).line((d: { c: GeoJSON.Position[] }) => d.c).draw(); | ||
| } else { | ||
| this.arrowFeatureLayer.data([]).draw(); | ||
| } | ||
| } else { | ||
| this.arrowFeatureLayer.data([]).draw(); | ||
| } | ||
| } else { | ||
| this.arrowFeatureLayer.data([]).draw(); | ||
| } | ||
| } else { | ||
| this.arrowFeatureLayer.data([]).draw(); | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
Can this be rewritten to be less nested? I see a lot of failure cases that are doing the same thing (clearing the arrow feature)
Co-authored-by: Michael Nagler <mike.nagler@kitware.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.